<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      class NewArr extends Array {
        constructor(...args) {
          super(...args);
        }
        first() {
          return this[0];
        }
        add(value) {
          this.push(value);
        }
        remove(value) {
          let pos = this.findIndex((curValue) => {
            return curValue == value;
          });
          this.splice(pos, 1);
        }
      }
      let hd = new NewArr(5, 3, 2, 1);
      console.log(hd.length);
      console.log(hd.first());

      hd.add('houdunren');
      console.log(hd.join(','));
      hd.reduce('3');
      console.log(hd.join(','));
    </script>
  </body>
</html>
